﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:local="clr-namespace:EIA.SLClient.PlatManage.BasicMgr"
	xmlns:EIA_SLClient_Utility_Converters="clr-namespace:EIA.SLClient.Utility.Converters;assembly=EIA.SLClient.Utility" xmlns:EIA_SLClient_Utility_Controls="clr-namespace:EIA.SLClient.Utility.Controls;assembly=EIA.SLClient.Utility"
	xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:EIA_SLClient_Utility_Behaviors="clr-namespace:EIA.SLClient.Utility.Behaviors;assembly=EIA.SLClient.Utility"
	xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
	mc:Ignorable="d"
	x:Class="EIA.SLClient.PlatManage.BasicMgr.StaffEditView"
	d:DesignWidth="640" d:DesignHeight="480">
	<UserControl.Resources>
		<ResourceDictionary>
			<local:StaffEditViewModel x:Key="StaffEditViewModelDataSource" />
		</ResourceDictionary>
	</UserControl.Resources>
	<UserControl.FontSize>
		<StaticResource ResourceKey="FontSize"/>
	</UserControl.FontSize>
	<UserControl.FontFamily>
		<StaticResource ResourceKey="FontFamily"/>
	</UserControl.FontFamily>

	<Grid x:Name="LayoutRoot" DataContext="{Binding Source={StaticResource StaffEditViewModelDataSource}}">
		<Grid Background="#19FFFFFF" Visibility="{Binding IsShow, Converter={StaticResource Bool2VisibilityConverter}, Mode=TwoWay}">
			<Grid HorizontalAlignment="Center" Height="380" VerticalAlignment="Center" Width="360">
				<Grid.Effect>
					<DropShadowEffect BlurRadius="1" ShadowDepth="1" Opacity="0.1"/>
				</Grid.Effect>
				<Grid.RowDefinitions>
					<RowDefinition Height="30"/>
					<RowDefinition/>
				</Grid.RowDefinitions>
				<Grid>
					<Path Data="M1.9999981,0 L298,0 C299.10458,0 300,0.89542961 300,1.9999981 L300,28.000002 L300,30 L298,30 L1.9999981,30 L0,30 L0,28.000002 L0,1.9999981 C1.1175871E-07,0.89542961 0.89543062,0 1.9999981,0 z" Stretch="Fill" StrokeThickness="0" UseLayoutRounding="False">
						<Path.Fill>
							<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.PlatManage.BasicMgr;component/assets/img/pop_header_bg.png"/>
						</Path.Fill>
					</Path>
					<StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
						<TextBlock TextWrapping="Wrap" Text="员工 - " Foreground="White" VerticalAlignment="Center" FontSize="14.667" Margin="16,0,0,0" HorizontalAlignment="Left"/>
						<TextBlock TextWrapping="Wrap" Text="{Binding TitleTip}" Foreground="White" VerticalAlignment="Center" FontSize="14.667" HorizontalAlignment="Left"/>
					</StackPanel>
					<Button Content="" BorderThickness="0" Padding="0" Style="{StaticResource button_clear_style}" Command="{Binding CancelCommand}" FontSize="14.667" HorizontalAlignment="Right" Width="16" Height="16" Margin="0,0,8,0" VerticalAlignment="Center">
						<Button.Background>
							<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.PlatManage.BasicMgr;component/assets/img/close-1.png"/>
						</Button.Background>
						<i:Interaction.Behaviors>
							<EIA_SLClient_Utility_Behaviors:Background4StateBehavior>
								<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundPressed>
									<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.PlatManage.BasicMgr;component/assets/img/close-2.png"/>
								</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundPressed>
								<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundNormal>
									<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.PlatManage.BasicMgr;component/assets/img/close-1.png"/>
								</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundNormal>
								<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundMouseOver>
									<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.PlatManage.BasicMgr;component/assets/img/close-2.png"/>
								</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundMouseOver>
								<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundDisabled>
									<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.PlatManage.BasicMgr;component/assets/img/close-1.png" Opacity="0.4"/>
								</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundDisabled>
							</EIA_SLClient_Utility_Behaviors:Background4StateBehavior>
						</i:Interaction.Behaviors>
					</Button>
				</Grid>
				<Border Grid.Row="1" BorderBrush="#FFE1E1E1" Background="White" BorderThickness="1,0,1,1">
					<Grid>
						<Grid Margin="8,8,8,52">
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="80"/>
								<ColumnDefinition/>
							</Grid.ColumnDefinitions>
							<Grid.RowDefinitions>
								<RowDefinition Height="Auto" MinHeight="32"/>
								<RowDefinition Height="Auto" MinHeight="32"/>
								<RowDefinition Height="Auto" MinHeight="32"/>
								<RowDefinition Height="Auto" MinHeight="32"/>
								<RowDefinition Height="Auto" MinHeight="32"/>
								<RowDefinition Height="Auto" MinHeight="32"/>
								<RowDefinition/>
							</Grid.RowDefinitions>
							<TextBlock TextWrapping="Wrap" Text="名称：" VerticalAlignment="Center" HorizontalAlignment="Right"/>
							<TextBlock TextWrapping="Wrap" Text="部门：" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="1"/>
							<TextBlock TextWrapping="Wrap" Text="职位：" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="2"/>
							<TextBlock TextWrapping="Wrap" Text="联系方式：" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="3"/>
							<TextBlock TextWrapping="Wrap" Text="登录用户名：" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="4"/>
							<TextBlock TextWrapping="Wrap" Text="登录密码：" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="5"/>
							<TextBox Grid.Column="1" HorizontalAlignment="Left" Margin="8,8,0,8" TextWrapping="Wrap" Text="{Binding Model.StfName, Mode=TwoWay}" d:LayoutOverrides="Height" Width="120" IsReadOnly="{Binding IsEditing, Converter={StaticResource BoolenRevertConverter}, Mode=OneWay}"/>
							<TextBox Grid.Column="1" HorizontalAlignment="Left" Margin="8,8,0,8" TextWrapping="Wrap" d:LayoutOverrides="Height" Width="120" IsReadOnly="True" Grid.Row="1" Text="{Binding Model.DepName, Mode=TwoWay}"/>
							<ComboBox x:Name="cbo_positions" Margin="8,10,0,10" Grid.Column="1" HorizontalAlignment="Left" Grid.Row="2" Width="120" VerticalAlignment="Center" IsEnabled="{Binding IsEditing, Mode=OneWay}" ItemsSource="{Binding PositionCollection}" DisplayMemberPath="PosName" SelectedItem="{Binding Position, Mode=TwoWay}"/>
							<TextBox Grid.Column="1" HorizontalAlignment="Left" Margin="8,8,0,8" TextWrapping="Wrap" Text="{Binding Model.ContactTel, Mode=TwoWay}" Width="120" IsReadOnly="{Binding IsEditing, Converter={StaticResource BoolenRevertConverter}, Mode=OneWay}" d:LayoutOverrides="Height" Grid.Row="3"/>
							<TextBox Grid.Column="1" HorizontalAlignment="Left" Margin="8,8,0,8" TextWrapping="Wrap" Text="{Binding UserEditVM.Model.LoginId, Mode=TwoWay}" Width="120" IsReadOnly="{Binding UserEditVM.IsEditing, Converter={StaticResource BoolenRevertConverter}, Mode=OneWay}" Grid.Row="4" d:LayoutOverrides="Height"/>
							<TextBox Grid.Column="1" HorizontalAlignment="Left" Margin="8,8,0,8" TextWrapping="Wrap" Width="120" IsReadOnly="{Binding UserEditVM.IsEditing, Converter={StaticResource BoolenRevertConverter}, Mode=OneWay}" Grid.Row="5" d:LayoutOverrides="Height" Text="{Binding UserEditVM.Model.LoginPwd, Mode=TwoWay}"/>
							<CheckBox Content="允许登录" Grid.Column="1" HorizontalAlignment="Left" Margin="8,8,0,0" Grid.Row="6" VerticalAlignment="Top" IsChecked="{Binding UserEditVM.Model.LoginAvalible, Converter={StaticResource Number2BoolConverter}, Mode=TwoWay}" IsEnabled="{Binding UserEditVM.IsEditing, Mode=OneWay}"/>
							<TextBlock HorizontalAlignment="Left" Margin="136,0,0,0" TextWrapping="Wrap" Text="已注销" Grid.Column="1" Foreground="Red" Visibility="{Binding Model.IsActive, ConverterParameter=f, Converter={StaticResource Number2VisibilityConverter}, Mode=OneWay}" VerticalAlignment="Center"/>
							<StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Grid.Column="1" Margin="194,12,0,12" Grid.Row="1" >
								<Popup x:Name="popup" Margin="0" >
									<i:Interaction.Behaviors>
										<EIA_SLClient_Utility_Behaviors:PopupCloseOnClickOutsideBehavior/>
									</i:Interaction.Behaviors>
									<Border Background="White" BorderBrush="#FF9B9B9B" HorizontalAlignment="Left" VerticalAlignment="Top" BorderThickness="1">
										<EIA_SLClient_Utility_Controls:SelectableTreeControl Width="180" RootNodes="{Binding DepartmentRootNodes}" SelectedData="{Binding Department, Mode=TwoWay}" MaxWidth="260" MaxHeight="600" ExpendDepth="2" Margin="0" MinHeight="200"/>
									</Border>
								</Popup>
							</StackPanel>
							<HyperlinkButton Grid.Column="1" HorizontalAlignment="Left" Margin="132,12,0,12" Grid.Row="1" d:LayoutOverrides="Height" Content="选择部门">
								<i:Interaction.Triggers>
									<i:EventTrigger EventName="Click">
										<ei:ChangePropertyAction TargetObject="{Binding ElementName=popup}" PropertyName="IsOpen" Value="True"/>
									</i:EventTrigger>
								</i:Interaction.Triggers>
							</HyperlinkButton>
							<HyperlinkButton Content="刷新列表" Grid.Column="1" HorizontalAlignment="Left" Margin="132,12,0,12" Grid.Row="2" d:LayoutOverrides="Height" IsEnabled="{Binding IsEditing, Mode=OneWay}">
								<i:Interaction.Triggers>
									<i:EventTrigger EventName="Click">
										<ei:CallMethodAction TargetObject="{Binding Mode=OneWay}" MethodName="LoadPositions"/>
									</i:EventTrigger>
								</i:Interaction.Triggers>
							</HyperlinkButton>
							<CheckBox Content="后台管理员" HorizontalAlignment="Left" Margin="136,8,0,0" Grid.Column="1" Grid.Row="6" VerticalAlignment="Top" IsEnabled="{Binding IsEditing, Mode=OneWay}" IsChecked="{Binding UserEditVM.Model.IsAdmin, Converter={StaticResource Number2BoolConverter}, Mode=TwoWay}"/>
						</Grid>
						<Button Content="关闭" BorderThickness="0" Padding="0" Style="{StaticResource button_clear_style}" Command="{Binding CancelCommand}" Height="30" VerticalAlignment="Bottom" Margin="0,0,8,8" FontSize="14.667" HorizontalAlignment="Right" Width="120" Foreground="#FF4C4C4C">
							<Button.Background>
								<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.PlatManage.BasicMgr;component/assets/img/btn1-1.png"/>
							</Button.Background>
							<i:Interaction.Behaviors>
								<EIA_SLClient_Utility_Behaviors:Background4StateBehavior>
									<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundPressed>
										<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.PlatManage.BasicMgr;component/assets/img/btn1-2.png"/>
									</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundPressed>
									<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundNormal>
										<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.PlatManage.BasicMgr;component/assets/img/btn1-1.png"/>
									</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundNormal>
									<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundMouseOver>
										<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.PlatManage.BasicMgr;component/assets/img/btn1-2.png"/>
									</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundMouseOver>
									<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundDisabled>
										<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.PlatManage.BasicMgr;component/assets/img/btn1-1.png" Opacity="0.4"/>
									</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundDisabled>
								</EIA_SLClient_Utility_Behaviors:Background4StateBehavior>
							</i:Interaction.Behaviors>
						</Button>
						<Button Content="保存" BorderThickness="0" Padding="0" Style="{StaticResource button_clear_style}" Command="{Binding SaveCommand}" Height="30" VerticalAlignment="Bottom" Margin="8,0,0,8" FontSize="14.667" HorizontalAlignment="Left" Width="120" Foreground="White">
							<Button.Background>
								<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.PlatManage.BasicMgr;component/assets/img/btn2-1.png"/>
							</Button.Background>
							<i:Interaction.Behaviors>
								<EIA_SLClient_Utility_Behaviors:Background4StateBehavior>
									<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundPressed>
										<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.PlatManage.BasicMgr;component/assets/img/btn2-2.png"/>
									</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundPressed>
									<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundNormal>
										<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.PlatManage.BasicMgr;component/assets/img/btn2-1.png"/>
									</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundNormal>
									<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundMouseOver>
										<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.PlatManage.BasicMgr;component/assets/img/btn2-2.png"/>
									</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundMouseOver>
									<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundDisabled>
										<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.PlatManage.BasicMgr;component/assets/img/btn2-1.png" Opacity="0.4"/>
									</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundDisabled>
								</EIA_SLClient_Utility_Behaviors:Background4StateBehavior>
							</i:Interaction.Behaviors>
						</Button>
					</Grid>
				</Border>
			</Grid>
		</Grid>
	</Grid>
</UserControl>
